﻿CREATE TABLE [dbo].[tblUserRightAssignment] (
    [UserID]  INT NOT NULL,
    [RightID] INT NOT NULL,
    [Enabled] BIT NOT NULL,
    PRIMARY KEY CLUSTERED ([UserID] ASC, [RightID] ASC) WITH (FILLFACTOR = 90, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF),
    FOREIGN KEY ([RightID]) REFERENCES [dbo].[tblUserRight] ([RightID]) ON DELETE NO ACTION ON UPDATE NO ACTION
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = 'Defines a set of rights for a specific user', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'tblUserRightAssignment';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = 'The user ID', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'tblUserRightAssignment', @level2type = N'COLUMN', @level2name = N'UserID';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = 'The Right ID', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'tblUserRightAssignment', @level2type = N'COLUMN', @level2name = N'RightID';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = 'Defines whether the right is enabled or disabled.  Disabling a right takes precedence over enable that right if both are present', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'tblUserRightAssignment', @level2type = N'COLUMN', @level2name = N'Enabled';

